Skip to content

Bug-Fix-Chamal#11

Open
Chamal Julan Kularathna (ChamalJulanJS) wants to merge 12 commits into
codezelaca:mainfrom
ChamalJulanJS:main
Open

Bug-Fix-Chamal#11
Chamal Julan Kularathna (ChamalJulanJS) wants to merge 12 commits into
codezelaca:mainfrom
ChamalJulanJS:main

Conversation

@ChamalJulanJS

@ChamalJulanJS Chamal Julan Kularathna (ChamalJulanJS) commented Jun 19, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Bug Fixes

    • Fixed form submission for adding checks
    • Corrected input validation logic
    • Fixed status filtering to work as expected
    • Updated dashboard metrics (Fixed count and Due soon calculations)
    • Fixed CSV export Title column mapping
    • Status changes now properly refresh filtered results
  • New Features

    • Enhanced search to match across multiple fields (title, category, priority, status, and owner)

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

js/app.js receives twelve targeted bug fixes: localStorage keys are unified under a single STORAGE_KEY; the form submit handler misspelling is corrected; add-check validation now triggers on either missing field; search matches across five fields; status filtering compares against check.status; status CSS classes are slugified; dashboard metrics correctly count "Fixed" and "due soon"; delete handling uses data-remove-id; status changes call applyFilters(); demo reset fetches from the corrected JSON path; and CSV export maps check.title.

Changes

Checklist App Bug Fixes

Layer / File(s) Summary
Storage key unification
js/app.js
Introduces a single STORAGE_KEY constant and updates both loadChecks() and saveChecks() to read/write from that key.
Form wiring and add-check validation
js/app.js
Fixes the form submit listener to call handleAddCheck (correcting a misspelling) and changes the missing-fields guard to trigger when either title or category is absent.
Filtering, search expansion, and status CSS class
js/app.js
Expands the search match to title/category/priority/status/owner fields, corrects the status filter to compare against check.status, and slugifies status strings (replacing spaces with hyphens) for the generated CSS class.
Dashboard metrics corrections
js/app.js
Fixes "Fixed" count to match status "Fixed" (previously "Complete") and corrects "due soon" to count checks due within 0–7 days inclusive.
Delete handling, status-change refresh, demo reset, and CSV export
js/app.js
Updates delete detection to [data-remove-id]/dataset.removeId, replaces the status-change refresh with saveChecks() + applyFilters(), updates demo reset to fetch data/launch-checks.json, and fixes CSV Title column to use check.title.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hoppity-hop through the buggy old code,
Keys unified, no more split road.
Filters now check the right field in line,
"Fixed" means Fixed — the metrics align!
Delete by remove-id, CSV by .title,
A cleaner, less buggy checklist revival! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Bug-Fix-Chamal' is vague and does not clearly describe the specific changes made. While it indicates a bug fix, it does not convey what bugs were fixed or which features were affected. Replace with a more descriptive title that summarizes the main bug fixes, such as 'Fix checklist app storage, validation, filtering, and metrics' or 'Correct localStorage keys, field validation, and dashboard calculations'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
js/app.js (1)

106-114: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Normalize loaded records before returning from storage.

JSON.parse(saved) is returned as-is. A malformed/stale item (e.g., missing owner or status) will later throw at filter/render time when calling string methods. Validate that parsed data is an array and normalize each check shape at load time.

Proposed fix
 function loadChecks() {
   const saved = localStorage.getItem(STORAGE_KEY);

   if (!saved) {
     return [...demoChecks];
   }

   try {
-    return JSON.parse(saved);
+    const parsed = JSON.parse(saved);
+    if (!Array.isArray(parsed)) return [...demoChecks];
+    return parsed.map((item) => ({
+      id: Number(item?.id ?? Date.now()),
+      title: String(item?.title ?? "").trim(),
+      category: String(item?.category ?? ""),
+      priority: String(item?.priority ?? "Low"),
+      status: String(item?.status ?? "Pending"),
+      owner: String(item?.owner ?? "Unassigned"),
+      dueDate: String(item?.dueDate ?? new Date().toISOString().slice(0, 10)),
+      notes: String(item?.notes ?? ""),
+    }));
   } catch (error) {
     console.warn("Could not parse saved launch checks.", error);
     return [...demoChecks];
   }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@js/app.js` around lines 106 - 114, The code in the try block returns the
parsed JSON without validating its structure or normalizing the data. After the
JSON.parse(saved) call, add validation to ensure the returned data is an array,
and then normalize each check object in that array to guarantee required fields
like owner and status exist with default values if missing. This prevents
runtime errors later when the filter and render operations attempt to call
string methods on potentially undefined properties. Return the normalized array
instead of the raw parsed result.
🧹 Nitpick comments (1)
js/app.js (1)

93-93: ⚡ Quick win

Remove stale “Intentional bug” comments.

These comments now contradict the fixed behavior and will confuse future debugging/reviews.

Also applies to: 135-135, 171-171, 175-175, 197-197, 237-237, 244-244, 256-256, 288-288, 295-295, 322-322

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@js/app.js` at line 93, Remove all stale "Intentional bug" comments throughout
the codebase that contradict the fixed behavior. Locate and delete the inline
comments (// Intentional bug: ...) from all specified locations in js/app.js at
lines 93, 135, 171, 175, 197, 237, 244, 256, 288, 295, and 322. These comments
were intended to mark known issues during development but the bugs have been
fixed, so the comments now create confusion for future maintainers and should be
completely removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@js/app.js`:
- Around line 106-114: The code in the try block returns the parsed JSON without
validating its structure or normalizing the data. After the JSON.parse(saved)
call, add validation to ensure the returned data is an array, and then normalize
each check object in that array to guarantee required fields like owner and
status exist with default values if missing. This prevents runtime errors later
when the filter and render operations attempt to call string methods on
potentially undefined properties. Return the normalized array instead of the raw
parsed result.

---

Nitpick comments:
In `@js/app.js`:
- Line 93: Remove all stale "Intentional bug" comments throughout the codebase
that contradict the fixed behavior. Locate and delete the inline comments (//
Intentional bug: ...) from all specified locations in js/app.js at lines 93,
135, 171, 175, 197, 237, 244, 256, 288, 295, and 322. These comments were
intended to mark known issues during development but the bugs have been fixed,
so the comments now create confusion for future maintainers and should be
completely removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 608a13b0-4d9d-46ba-950b-07795739c9c1

📥 Commits

Reviewing files that changed from the base of the PR and between ccb0d19 and 98e4642.

📒 Files selected for processing (1)
  • js/app.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant